#include <stdlib.h>
#include <string.h>
#include <stdio.h>

#include "c-utils/utils.h"

int crc16_test(char *raw, char *enc)
{
    return 0;
}

int crc32_test(char *raw, char *enc)
{
    return 0;
}

void help(const char *name)
{
    printf("eg: %s crc16  abcd1234 40311\n", name);
    printf("eg: %s crc32  abcd1234 1027584326\n", name);
}

int main(int argc, const char *argv[])
{
    if (argc != 4)
    {
        help(argv[0]);
        return -1;
    }

    if (strncmp(argv[1], "crc16", 5) == 0)
    {
        printf("crc16: %d\n", utils_crc16(argv[2], strlen(argv[2])));
        if (utils_crc16(argv[2], strlen(argv[2])) == atoi(argv[3]))
            return 0;
    }
    else if (strncmp(argv[1], "crc32", 5) == 0)
    {
        printf("crc32: %d\n", utils_crc32(argv[2], strlen(argv[2])));
        if (utils_crc32(argv[2], strlen(argv[2])) == atoi(argv[3]))
            return 0;
    }
    else
    {
        help(argv[0]);
    }
    return -1;
}